const Router = require('koa-router')
const ordersDao = require('../dao/ordersDao')
const router = new Router();

router.get('/orders/insert/:orderId/:bookId/:count' , async (ctx) => {
  const { orderId , bookId , count } = ctx.params;
  await ordersDao.insert(orderId , bookId , count);
  ctx.body = '200'
})

router.get('/orders/getBookByorderId/:orderId' , async (ctx) => {
  const { orderId } = ctx.params;
  ctx.body =  await ordersDao.getBookByorderId(orderId);
})


module.exports = router;